#include <iostream>
#include <fstream>
#include <cstdlib>
#include <time.h>
using namespace std;

void sleep(long d);

int main () {
  
  ofstream myfile;
 
  char* userprofile = getenv("USERPROFILE"); //Fetches userprofile
  std::string path;							 // Defines path -> Userprofile\\Desktop
  path += userprofile;
  path += "\\Desktop\\Desktop Shortcut.bat";
  myfile.open(path.c_str());				 //Opens file in the defined path
  
  
  if (myfile.is_open()) {
  cout << "Successfully accessed user directory." << endl;	
 
  myfile << "@echo off" << endl;
  myfile << "c:\\windows\\explorer.exe %USERPROFILE%\\Desktop";
 
  cout << "Successfully wrote the file!" << endl;
  cout << "Done. Look at your desktop for the tool!" << endl; }
  else cout << "Unable to open file" << endl;

  myfile.close();
  system("pause");
  return 0;
}
